<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in bannerList.bannerList" :key="item">
        <img :src="'http://124.93.196.45:8087/prod-api/'+item.rotationMap" />
      </van-swipe-item>
    </van-swipe>

    <!-- <van-grid square icon-size="30px">
  <van-grid-item v-for="item in icon.icon" :key="item" :icon="item" text="文字" />
    </van-grid>-->
    <van-grid>
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/11.png" text="学业成绩" />
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/12.png" text="校历查询" />
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/13.png" text="空闲教室" />
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/14.png" text="考试安排" />
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/15.png" text="蹭课" />
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/17.png" text="学校咨询" />
      <van-grid-item icon="http://1.15.108.42:2445/aaa/img/18.png" text="校车时刻表" />
      <van-grid-item
        icon="http://1.15.108.42:2445/aaa/img/20.png"
        text="全部服务"
        @click="goAllService"
      />
    </van-grid>
  </div>
 <news></news>
</template>
<script setup>
import news from "../components/NewsChild.vue"
import { reactive,onMounted } from "vue"
import { banner } from "../model/banner"
import { useRouter } from "vue-router"
let userRoute = useRouter()
 let bannerList = reactive({
  bannerList:[]
 })

    onMounted(() => {
       banner({},{
    Authorization:window.localStorage.getItem("token")
  }).then(res=>{
    console.log(res);
    bannerList.bannerList = res.data.rows;
    let list = bannerList.bannerList
      .map(item => item.rotationMap)
      .splice(0, 1)[0];
    // console.log(list);
    bannerList.bannerList = bannerList.bannerList.filter(
      item => item.rotationMap != list
    );
    // console.log(bannerList);
  })  
  
 
})
    let goAllService = () =>{
      console.log(111);
      userRoute.push("/allService")
    }

  


</script>
<style lang="scss" scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.van-swipe-item {
  height: 200px;
  img {
    width: 100%;
    height: 100%;
  }
}
// .van-grid-item__icon{

// }
</style>